import java.io.*;
import java.util.*;

class Read {
    StringTokenizer st=new StringTokenizer("");
    BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));

    public String next() throws IOException {
        while (!st.hasMoreTokens()) {
            st=new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }
    public String nextLine() throws IOException {
        return bf.readLine();
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
}
public class Main {
    static Read in=new Read();
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) throws IOException {
        int a = in.nextInt();
        int b = in.nextInt();
        for(int i = a;i <= b;i++) {
            if(check(i)) {
                out.println(i);
            }
        }
        out.close();
    }
    //判断平方数
    public static boolean is_sqrt(int n) {
        int t = (int)Math.sqrt(n);
        if(t * t == n) {
            return true;
        }
        return false;
    }

    //判断拼接平方数
    public static boolean check(int n) {
        String s = String.valueOf(n);
        for(int i = 1;i < s.length();i++) {
            if(is_sqrt(n) && is_sqrt(Integer.parseInt(s.substring(0,i)))  &&
                    is_sqrt(Integer.parseInt(s.substring(i))) &&
                    Integer.parseInt(s.substring(0,i)) != 0 &&
                    Integer.parseInt(s.substring(i)) != 0) {
                return true;
            }
        }
        return false;
    }
    public int[] searchRange(int[] nums, int target) {
        int[] ret=new int[2];
        ret[0]=-1;ret[1]=-1;
        if(nums.length==0){
            return ret;
        }
        int left=0,right=nums.length-1;
        while(left<right){
            int mid=left+(right-left)/2;
            if(nums[mid]<target){
                left=mid+1;
            }
            else{
                right=mid;
            }
        }
        if(nums[left]==target){
            ret[0]=left;
        }
        else{
            return ret;
        }
        right=nums.length-1;
        while(left<right){
            int mid=left+(right-left+1)/2;
            if(nums[mid]<=target){
                left=mid;
            }
            else{
                right=mid-1;
            }
        }
        ret[1]=left;
        return ret;
    }
    public double myPow(double x, int n) {
        return n>0?Pow(x,n):1.0/Pow(x,-n);
    }
    public double Pow(double x,int n){
        if(n==0) return 1.0;
        double ret=Pow(x,n/2);
        return n%2==0?ret*ret:ret*ret*x;
    }
    public String countAndSay(int n) {
        String ret="1";
        for(int i=1;i<n;i++){
            StringBuilder str=new StringBuilder();
            for(int left=0,right=0;right<ret.length();){
                char x=ret.charAt(left);
                while(right<ret.length()&&ret.charAt(right)==x){
                    right++;
                }
                str.append(Integer.toString(right-left));
                str.append(x);
                left=right;
            }
            ret=str.toString();
        }
        return ret;
    }
    public List<Integer> findSubstring(String ss, String[] tt) {
        List<Integer> ret=new ArrayList<>();
        Map<String,Integer> hash1=new HashMap<>();
        int n=tt.length,m=tt[0].length();
        for(String t:tt){
            hash1.put(t,hash1.getOrDefault(t,0)+1);
        }
        for(int i=0;i<m;i++){
            Map<String,Integer> hash2=new HashMap<>();
            for(int left=i,right=i,count=0;right+m<=ss.length();right+=m){
                String in=ss.substring(right,right+m);
                hash2.put(in,hash2.getOrDefault(in,0)+1);
                if(hash2.get(in)<=hash1.getOrDefault(in,0)) count++;
                if(right-left+1>m*n){
                    String out=ss.substring(left,left+m);
                    if(hash2.get(out)<=hash1.getOrDefault(out,0)) count--;
                    hash2.put(out,hash2.get(out)-1);
                    left+=m;
                }
                if(count==n) ret.add(left);
            }
        }
        return ret;
    }

}